/*河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
*/
package cn.javaxc.mes.action.produce;
import java.io.*;
import java.util.*;
import java.sql.*;
import cn.javaxc.model.base.SQL;
import cn.javaxc.model.base.SQLList;
import cn.javaxc.model.base.SQLMap;
import cn.javaxc.model.base.SQLParam;
import cn.javaxc.model.page.BatisPage;
import cn.javaxc.mvcwork.controller.web.TreeBean;
import cn.javaxc.mvcwork.util.common.CommonUtil;
import cn.javaxc.mvcwork.util.common.MapListUtil;
import cn.javaxc.mvcwork.util.helper.FrameHelper;
import cn.javaxc.mvcwork.util.helper.TreeTableHelper;
import org.springframework.beans.factory.annotation.Autowired;
import cn.javaxc.system.action.base.BaseAction;
import cn.javaxc.mes.mapper.produce.MftResourceMapper;
public class MftResourceAction extends BaseAction
{
    @Autowired(required=false)
	private MftResourceMapper mapper;
    /**
    制造资源布局图
    */
    
    public Map mftResourceLayout() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_layout=mapper.s_layout(params);
        result.put("s_layout", s_layout);
        
        return result;
    }
    /**
    工位列表
    */
    
    public Map stationList() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> p_work_position=mapper.p_work_position(params,pagination);
        p_work_position.setPagedListInfo(pagination);
        result.put("p_work_position", p_work_position);
        
        return result;
    }
    /**
    填写工作能力
    */
    
    public Map stationAbility() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_work_position=mapper.s_work_position(params);
        SQLMap s_work_position_emt=s_work_position.getExistfirst();
        result.put("s_work_position", s_work_position_emt);
        
        
        SQLList<SQLMap> s_work_position_device=mapper.s_work_position_device(params);
        result.put("s_work_position_device", s_work_position_device);
        
        
        SQLList<SQLMap> s_work_person=mapper.s_work_person(params);
        result.put("s_work_person", s_work_person);
        
        
        SQLList<SQLMap> s_stuff=mapper.s_stuff(params);
        result.put("s_stuff", s_stuff);
        
        
        
        
        SQLList<SQLMap> s_able=mapper.s_able(params);
        SQLMap s_able_emt=s_able.getExistfirst();
        result.put("s_able", s_able_emt);
        
        
        
        return result;
    }
    /**
    编写工序生产力
    */
    
    public Map procedureAbility() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> pro_list=mapper.pro_list(params);
        result.put("pro_list", pro_list);
        
        
        SQLList<SQLMap> s_able=mapper.s_able(params);
        SQLMap s_able_emt=s_able.getExistfirst();
        result.put("s_able", s_able_emt);
        
        return result;
    }
    /**
    生产布局管理
    */
    
    public Map proLayoutMana() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_layout=mapper.s_layout(params);
        result.put("s_layout", s_layout);
        
        return result;
    }
    /**
    生产布局
    */
    
    public Map proLayout() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> layout=mapper.layout(params);
        SQLMap layout_emt=layout.getExistfirst();
        result.put("layout", layout_emt);
        
        
        SQLList<SQLMap> layout_item=mapper.layout_item(params);
        result.put("layout_item", layout_item);
        
        return result;
    }
    /**
    布局配置
    */
    
    public Map layoutDeploy() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> layout_item=mapper.layout_item(params);
        result.put("layout_item", layout_item);
        
        
        
        
        
        return result;
    }
    /**
    工序列表
    */
    
    public Map procedureList() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_pro=mapper.s_pro(params);
        result.put("s_pro", s_pro);
        
        return result;
    }
    /**
    选择工序
    */
    
    public Map procedureChoice() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_pro=mapper.s_pro(params);
        result.put("s_pro", s_pro);
        
        
        
        return result;
    }
    /**
    工位明细
    */
    
    public Map stationDet() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_work_position=mapper.s_work_position(params);
        SQLMap s_work_position_emt=s_work_position.getExistfirst();
        result.put("s_work_position", s_work_position_emt);
        
        return result;
    }
    /**
    修改
    */
    
    public Map stationUp() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_work_position=mapper.s_work_position(params);
        SQLMap s_work_position_emt=s_work_position.getExistfirst();
        result.put("s_work_position", s_work_position_emt);
        
        return result;
    }
    /**
    工位设备
    */
    
    public Map stationDev() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_work_position_device=mapper.s_work_position_device(params);
        result.put("s_work_position_device", s_work_position_device);
        
        return result;
    }
    /**
    选择设备
    */
    
    public Map devChoice() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> produce_info=mapper.produce_info(params,pagination);
        produce_info.setPagedListInfo(pagination);
        result.put("produce_info", produce_info);
        
        return result;
    }
    /**
    工位人员
    */
    
    public Map stationPer() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_work_person=mapper.s_work_person(params);
        result.put("s_work_person", s_work_person);
        
        return result;
    }
    /**
    人员列表
    */
    
    public Map perList() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        params.def("category_id",-1);
        SQLList<SQLMap> s_firm=mapper.s_firm(params);
        result.put("s_firm", s_firm);
        
        
        params.def("category_id",-1);
        SQLList<SQLMap> cate=mapper.cate(params);
        SQLMap cate_emt=cate.getExistfirst();
        result.put("cate", cate_emt);
        
        
        params.def("category_id",-1);
        SQLList<SQLMap> person_info=mapper.person_info(params);
        result.put("person_info", person_info);
        
        
        
        
        SQLList<SQLMap> s_work_person=mapper.s_work_person(params);
        result.put("s_work_person", s_work_person);
        
        
        
        
        
        return result;
    }
    /**
    添加关联设备
    */
    
    public Map stationRelationDevAdd() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_device=mapper.s_device(params);
        result.put("s_device", s_device);
        
        
        SQLList<SQLMap> s_relat=mapper.s_relat(params);
        result.put("s_relat", s_relat);
        
        return result;
    }
    /**
    原件材料
    */
    
    public Map stationMaterial() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_stuff=mapper.s_stuff(params);
        result.put("s_stuff", s_stuff);
        
        return result;
    }
    /**
    选择材料
    */
    
    public Map materialChoice() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> produce=mapper.produce(params);
        produce.setSelectNone("produce备注");
        result.put("produce", produce);
        
        
        SQLList<SQLMap> classid=mapper.classid(params);
        classid.setSelectNone("classid备注");
        result.put("classid", classid);
        
        
        SQLList<SQLMap> cate=mapper.cate(params);
        SQLMap cate_emt=cate.getExistfirst();
        result.put("cate", cate_emt);
        
        
        SQLList<SQLMap> s_stuff=mapper.s_stuff(params);
        result.put("s_stuff", s_stuff);
        
        return result;
    }
    /**
    填写工作能力修改
    */
    
    public Map stationAbilitySubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        Object work_position_cnt =
        mapper.work_position_cnt(params);
        result.put("work_position_cnt", work_position_cnt);
        
        
        int i_able = mapper.i_able(params);
        result.put("i_able", i_able);
        
        
        int u_position = mapper.u_position(params);
        result.put("u_position", u_position);
        
        return result;
    }
    /**
    编写工序生产力修改
    */
    
    public Map procedureAbilitySubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        Object tech_able_cnt =
        mapper.tech_able_cnt(params);
        result.put("tech_able_cnt", tech_able_cnt);
        
        
        int i_able = mapper.i_able(params);
        result.put("i_able", i_able);
        
        
        int u_able = mapper.u_able(params);
        result.put("u_able", u_able);
        
        return result;
    }
    /**
    布局配置修改
    */
    
    public Map layoutDeploySubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        for (SQLMap emt:hqlBean.getTableElements("work_position")){
            params=new SQLParam(request,emt.getMap());
            mapper.CMID(params);
        }
        
        
        int u_layout_item = mapper.u_layout_item(params);
        result.put("u_layout_item", u_layout_item);
        
        return result;
    }
    /**
    */
    
    public Map d_process() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.d_process(params);
        
        return result;
    }
    /**
    增加工位修改
    */
    
    public Map stationAddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int CMID = mapper.CMID(params);
        result.put("CMID", CMID);
        
        return result;
    }
    /**
    修改修改
    */
    
    public Map stationUpSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        Object layout_item_cnt =
        mapper.layout_item_cnt(params);
        result.put("layout_item_cnt", layout_item_cnt);
        
        
        int u_layout_item = mapper.u_layout_item(params);
        result.put("u_layout_item", u_layout_item);
        
        return result;
    }
    /**
    */
    
    public Map d_device() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.d_device(params);
        
        return result;
    }
    /**
    选择设备修改
    */
    
    public Map devChoiceSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        for (SQLMap emt:hqlBean.getTableElements("pro_device")){
            params=new SQLParam(request,emt.getMap());
            mapper.i_device(params);
        }
        
        return result;
    }
    /**
    人员列表修改
    */
    
    public Map perListSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        for (SQLMap emt:hqlBean.getTableElements("work_position_person")){
            params=new SQLParam(request,emt.getMap());
            mapper.i_s(params);
        }
        
        return result;
    }
    /**
    添加关联设备修改
    */
    
    public Map stationRelationDevAddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int d_relat = mapper.d_relat(params);
        result.put("d_relat", d_relat);
        
        
        for (SQLMap emt:hqlBean.getTableElements("device_relat")){
            params=new SQLParam(request,emt.getMap());
            mapper.i_relat(params);
        }
        
        return result;
    }
    /**
    选择材料修改
    */
    
    public Map materialChoiceSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        for (SQLMap emt:hqlBean.getTableElements("work_position_stuff")){
            params=new SQLParam(request,emt.getMap());
            mapper.i_stuff(params);
        }
        
        return result;
    }
}